<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp" %>
<%@include file="/common/javascript.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>序号设定</title>
    <script type="text/javascript">
	    var mainform;
	    var viewType = "${viewType}";
        $(function ()
        {        
            mainform=$("#mainform");
            
            mainform.ligerForm();
            
            if(viewType=="modify"){
            	 $("#sqId").attr("readonly", "readonly").removeAttr("validate");
            }
            
            if(viewType=="detail"){
            	$("input,select,textarea",mainform).attr("readonly", "readonly");
            }else{
                $.metadata.setType("attr", "validate");
                LG.validate(mainform);
            }
            
            LG.setFormDefaultBtn(cancel,viewType=="detail" ? null : save);

        });  
        
        function save(){
            LG.submitForm(mainform, function (result) {
            	if(typeof(result)=="string"){
            		result=eval("("+result+")");
            	}
                if (!result.success) {
                    LG.showError('错误:' + data.message);
                }
                else { 
                    LG.showSuccess('保存成功', function () { 
                       LG.callParent("companyList");
                    });
                }
            });
        }
        function cancel(){
            var win = window.parent || window;
            if(win.dialog){
            	win.dialog.close();
            }
        }
    </script>
</head>

<body style="padding:10px">
    <form name="mainform" method="post"  id="mainform" action="${ctx }/sequence/save">
        <input type="hidden" name="viewType" value="${viewType}"/>
        <table cellpadding="0" cellspacing="0" class="l-table-edit" style="width: 100%;">
            <tr>
                <td align="left" class="l-table-edit-td" valign="top">代码:</td>
                <td align="left" class="l-table-edit-td" style="width:80px"  colspan="4">
                	<input type="text"  name="sqId" id="sqId" value="${command.sqId }" ltype="text" validate="{required:true,minlength:2,maxlength:50,notnull:true,remote:'${ctx}/sequence/checkSqId?oldSqId=${command.sqId}'}"/>
                </td>
                <td align="left"></td>
            </tr>
            <tr>
                <td align="left" class="l-table-edit-td" valign="top">用途:</td>
                <td align="left" class="l-table-edit-td" style="width:80px"  colspan="4">
	               <input type="text"  name="sqTitle" id="sqTitle" value="${command.sqTitle }" ltype="text" validate="{required:true,minlength:1,maxlength:50,notnull:true}"/>
                </td>
                <td align="left"></td>
            </tr>
            <tr>
                <td align="left" class="l-table-edit-td" valign="top">字轨:</td>
                <td align="left" class="l-table-edit-td" style="width:80px"  colspan="4">
                	<input type="text"  name="sqPrefix" id="sqPrefix" value="${command.sqPrefix }" ltype="text" validate="{maxlength:5}"/>
                </td>
                <td align="left"></td>
            </tr>
            <tr>
                <td align="left" class="l-table-edit-td" valign="top">编码:</td>
                <td align="left" class="l-table-edit-td" style="width:80px" colspan="4">
                	<input type="text" name="sqFormat" id="sqFormat" value="${command.sqFormat }" ltype="text" validate="{required:true,notnull:true}"/>
                </td>
                <td align="left"></td>
            </tr>
            <tr>
                <td align="left" class="l-table-edit-td" valign="top">总长度:</td>
                <td align="left" class="l-table-edit-td" style="width:80px" colspan="4">
                	<input type="text" name="sqLength" id="sqLength" value="${command.sqLength }" ltype="text" validate="{digits:true,max:100,notnull:true}"/>
                </td>
                <td align="left"></td>
            </tr>
            <tr>
                <td align="left" class="l-table-edit-td">备注:</td>
                <td align="left" class="l-table-edit-td"  colspan="4"> 
                <textarea cols="100" rows="3" class="l-textarea" id="remark" name="remark" style="width:400px">${command.remark}</textarea>
                </td> <td align="left"></td>
           </tr>
           <tr>
                <td align="left" class="l-table-edit-td" valign="top">建档人:</td>
                <td align="left" class="l-table-edit-td" style="width:80px">${command.userCre }</td>
                <td align="left"></td>
                
                <td align="left" class="l-table-edit-td" valign="top">修改人:</td>
                <td align="left" class="l-table-edit-td" style="width:80px">${command.userUpd }</td>
                <td align="left"></td>
           </tr>
        </table>
    </form>
</body>
</html>
